package stackSample;


public class Stack {

	final static int MSIZE = 10; 
	int currPos = 0;
	int[] val = new int[MSIZE];

	public void push(int a) {
		if (pushPre()) {
			throw new RuntimeException("cannot push; full stack");
		}
		val[currPos++] = a;
	}

	public void pop() {
		if (popPre()) {
			throw new RuntimeException("cannot pop; empty stack");
		}
		currPos--;
	}

	public boolean pushPre() {
		return currPos >= MSIZE;
	}

	public boolean popPre() {
		return currPos <= 0;
	}

}